<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:include="common">
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <!--场次列表-->
    <div class="modal fade" id="addDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="modal-title" id="myModalLabel">场次</h4>
                </div>
                <div class="modal-body">
                    <form id="addForm" action="<%=path%>/erp/addComm.do" method="post">
                        <table id="sessionTable"></table>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" id="btn_submit" onclick="addUser()">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
                </div>
            </div>
        </div>
    </div>
  <table id="goodsTable"></table>
</body>
<script>
    $(function(){
        queryMap();
    })
    function queryMap(){
        $("#goodsTable").bootstrapTable({
            url:"/goodsConsummer/recycleSelectMap?goodsId=0",
            columns:[
                {field:"goodsCheckbox",checkbox:true},
                {field:"goodsId",title:"商品id"},
                {field:"goodsName",title:"商品名称"},
                {field:"goodsStartTime",title:"开始时间"},
                {field:"goodsEndTime",title:"结束时间"},
                {field:"goodsAdress",title:"详细地址"},
                {field:"goodsMainActor",title:"主要演员"},
                {field:"goodsDuration",title:"演出时长"},
                {field:"goodsImg",title:"商品图片",
                    formatter:function(value,row){
                        return "<img src='"+value+"'  style='width:50px;height:50px'/>"
                    }
                },
                {field:"caoz",title:"操作",
                    formatter:function(value,row){

                        return  "<a href='javascript:showSession("+row.goodsId+")'>管理座位</a> "
                        /*onclick="updateUpGoods('+row.goodsId+')*/

                    }
                }
            ],
            pagination:true,
            pageSize:10,
            pageList:[10,15],
            sidePagination:'server',
        })
    }
    function showSession(id){

        $("#sessionTable").bootstrapTable({
            url:"/goodsConsummer/getSessionList?goodsId="+id,
            columns:[
                {field:"goodsCheckbox",checkbox:true},
                {field:"sessionId",title:"场次id"},
                {field:"goodsTicketsVendibilityCount",title:"座位数"},
                {field:"onlineDescription",title:"场次描述"},
                {field:"caoz",title:"操作",
                    formatter:function(value,row){
                        if(row.siteInfo!=null && row.siteInfo !=''){
                            return "<a href='javascript:toShowSite("+row.sessionId+")'>查看座位</a> ";
                        }
                        return  "<a href='javascript:toSetSite("+row.sessionId+","+row.goodsTicketsVendibilityCount+")'>设置座位</a> ";
                        /*onclick="updateUpGoods('+row.goodsId+')*/

                    }
                }
            ],
            pagination:true,
            pageSize:10,
            pageList:[10,15],
            sidePagination:'client',
        })
        $("#addDialog").modal();
    }
    //设置座位
    function toSetSite(id,count){
        location.href="/addSite?sessionId="+id+"&count="+count;
    }
    //查看座位
    function toShowSite(id){
        location.href="/showSite?sessionId="+id;
    }
</script>
</html>